#
# @lc app=leetcode.cn id=78 lang=python
#
# [78] 子集
#

# @lc code=start
class Solution(object):
    def subsets(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        self.nums = nums
        self.result = []
        self.sub = []
        self.loop(0)
        return self.result

    def loop(self, index):
        self.result.append(self.sub[:])
        
        for i in range(index, len(self.nums)):
            self.sub.append(self.nums[i])
            self.loop(i+1)
            self.sub.pop()
        
# @lc code=end

